#include <stdio.h>
#include <stdlib.h>

int is_leap(int);

int main()
{
    char day_list[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int month = 0, day = 0, year = 0;
    int sum = 0;
    scanf("%d-%d-%d", &month, &day, &year);
    if(is_leap(year))day_list[1]++;
    for(int i = 0; i<month-1; i++)sum+=day_list[i];
    sum+=day;
    printf("sum:%d\n", sum);
    return 0;
}

int is_leap(int year)
{
    if(year % 100)
    {
        return !(year % 4);
    }
    else
    {
        return !(year % 400);
    }
}